			$<PRI_TBL_ID> = $this->input->post('<PRI_TBL_ID>');

			if ($<PRI_TBL_ID> > 0) {
				$fUpdate       = true;
				$data['<PRI_TBL_ID>']  = $<PRI_TBL_ID>;
			} else {
				$fUpdate       = false;
			}
			/**
			 * Load lang to show msg
			 */
			$this->lang->load('success', $this->lang_tag);
			$this->lang->load('error', $this->lang_tag);
			///// Start transaction /////
			/////////////////////////////
			$this->db->trans_begin();

			$ret = $this-><CTR_NAME>_model->store($data, '<PRI_TBL_ID>', true, $fUpdate);

			if ($ret == FALSE) {
			    $this->messages->add($this->lang->line('db_insert_update_err'), 'error');
			    // Rollback transaction
			    $this->db->trans_rollback();
			} else {

                if ($fUpdate) {
                    $this->messages->add($this->lang->line('db_update_success'), 'success');
                } else {
                    $this->messages->add($this->lang->line('db_insert_success'), 'success');
                }
                // Commit transaction
                $this->db->trans_commit();
			}
